home *** CD-ROM | disk | FTP | other *** search
Modula Definition | 1998-11-09 | 4.4 KB | 124 lines |
- (*#-- BEGIN AutoRevision header, please do NOT edit!
- *
- * $VER: XpkPrefs.def 1.3 (11.06.1998)
- * Auth: T.B. <tonyiommi@geocities.com>
- *
- * Desc: This module you will need, if you want to write your own preferences system.
- * Reqs: AMIGA OS 2.0
- * Lang: MODULA-2
- * Comp: Cyclone © by M. Timmermans
- *
- *-- END AutoRevision header --*)
-
- DEFINITION MODULE XpkPrefs; (*$ Implementation- *)
-
- FROM SYSTEM IMPORT ADDRESS,CAST,LONGSET;
- FROM ExecD IMPORT SignalSemaphore,TaskPtr;
- FROM UtilityD IMPORT HookPtr,TagItemPtr;
-
- TYPE StrPtr = ADDRESS;
-
- CONST
- xpkT = CAST(LONGINT,"XPKT");
- xpkM = CAST(LONGINT,"XPKM");
-
- (* --- XpkTypeData structure --- *)
- tdNoPack = 1; (* filetype should not be crunched *)
- tdReturnError = 2; (* return error errNoMethod *)
- (* These two cannot be set same time! *)
-
- TYPE
- TypeDataPtr=POINTER TO TypeData;
- TypeData=RECORD
- flags :LONGSET; (* see above td flags *)
- stdID, (* holding the ID --> 'NUKE *)
- chunkSize :LONGINT; (* maybe useless with external crunchers *)
- mode, (* PackMode *)
- version :INTEGER; (* structure version --> 0 at the moment *)
- password, (* not used at the moment *)
- memory :StrPtr; (* memory pointer - when should be freed by *)
- memorySize:LONGINT; (* memory size - receiver (xpkmaster) *)
- END;
-
- (* --- XpkTypePrefs structure --- *)
- CONST
- tpNamePattern = 1; (* File Pattern is given *)
- tpFilePattern = 2; (* Name Pattern is given *)
- (* These can both be set (in loading this means File AND Name Pattern have to match), but one is needed *)
-
- TYPE
- TypePrefsPtr=POINTER TO TypePrefs;
- TypePrefs=RECORD
- flags :LONGSET; (* See above tp Flags *)
- typeName, (* Name of this file type (for prefs program) *)
- namePattern, (* Pointer to NamePattern *)
- filePattern :StrPtr; (* Pointer to FilePattern *)
- packerData :TypeDataPtr;
- END;
-
- (* --- XpkMainPrefs structure --- *)
- CONST
- mpUseXFD = 1; (* Use xfdmaster.library for unpacking *)
- mpUseExternals = 2; (* Use xex libraries *)
- mpAutoPassword = 4; (* Use the automatic password requester *)
-
- TYPE
- MainPrefsPtr=POINTER TO MainPrefs;
- MainPrefs=RECORD
- version, (* version of structure ==> 0 *)
- flags :LONGSET; (* above defined mp flags *)
- defaultType :TypeDataPtr; (* sets the mode used as default *)
- timeout :INTEGER; (* Timeout for password requester given in seconds, zero means no timeout *)
- END;
-
- (*
- The library internal defaults are:
- mpUseXFD FALSE
- mpAutoPassword FALSE
- mpUseExternals TRUE
- mpReturnError defined as default
- mpTimeOut set to 120 (two minutes)
-
- These defaults are used, when no preferences file is given.
- *)
-
- (* --- XpkMasterPrefs Semaphore structure ---
- *
- * find with FindSemaphore(PrefsSemName);
- *
- * obtain with ObtainSemaphoreShared(),
- * programs WRITING into the structure fields must know:
- * - use ObtainSemaphore() instead of ObtainSemaphoreShared()
- * - free memory of elements you remove
- * - xb_MainPrefsSize is the length of memory allocated for xb_MainPrefs
- * - all other nodes are freed, when XpkMasterPrefs program finishes, do
- * not do it your own, but you have to allocate memory for new ones!
- * Generally there should be no need to write to these fields !!!!
- *)
-
- CONST
- prefsSemName = "« XPKMasterPrefs »";
-
- (* Defines used for xps_PrefsType. These help to find out, which preferences type is used. *)
- pefsTypeStandard = CAST(LONGINT,"XPKM");
- prefsTypeCYB = CAST(LONGINT," CYB");
-
- TYPE
- PrefsSemaphorePtr=POINTER TO PrefsSemaphore;
- PrefsSemaphore=RECORD
- semaphore :SignalSemaphore;
- version :LONGINT; (* at the moment 0 *)
- prefsType :LONGINT; (* preferences type *)
- prefsData :ADDRESS; (* preferences data *)
- mainPrefs :MainPrefsPtr; (* defined defaults *)
- recogSize :LONGINT; (* needed size of Recogbuffer *)
- //PROCEDURE recogFunc(buffer{8},fileName{9}:StrPtr; bufferSize{0},fullSize{1}:LONGINT; tags{10}:TagItemPtr):TypeDataPtr;
- recogFunc :POINTER TO PROCEDURE(StrPtr,StrPtr,LONGINT,LONGINT,TagItemPtr):TypeDataPtr;
- progressHook :HookPtr; (* hook function *)
- masterTask :TaskPtr; (* Creater's task *)
- END;
-
- (* Use Signal(sem^.psMasterTask, DosD.ctrlC); to get the installer program to remove the semaphore. *)
-
- END XpkPrefs.
-